<?php
	class FlashAction extends BaseAction{
		public function index(){
			if($this->isPost()){
					$pic                = $_FILES['f_img'];
					if($pic['name']    != ""){
						$tmpname        = $pic['tmp_name'];
						$type           = $pic['type'];
						$type2          = explode('/',$type);
						$type           = $type2[0];
						$picture        = 'f_'.time().rand(1000,9999).".".jpg;
						$error          = $pic['error'];
						$newname        = 'Public/Upload/'.$picture;

						if(is_uploaded_file($tmpname) && $type=='image' && $error=='0'){
							move_uploaded_file($tmpname,$newname);
						}
					}
					$data['f_type']   = $_POST['f_type'];
					$data['f_img']    = $picture;
					$result = D("Falshpicture")->falsh($data);
					if($result){
						$this->redirect("Falshpicture/lists",0,1,'添加成功');
					}
				}else{
					
			
					$this->assign("district",$area);
					$this->assign("shop",$shop);
					$this->assign("message",$msg);
			
					$this->display();
				}
		}
	}



?>